package com.home.moon.chat.controller;

import com.home.moon.chat.model.Follows;
import com.home.moon.chat.model.Users;
import com.home.moon.chat.service.impl.UserServiceImpl;
import com.home.moon.util.UnionResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author auto
 */
@Api(tags = "用户管理")
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserServiceImpl userService;

    @ApiOperation("查询单个用户")
    @PostMapping("/getUser")
    @ResponseBody
    public UnionResult getUser(@RequestBody Users query){
        return UnionResult.OK(userService.getUser(query));
    }

    @ApiOperation("关注")
    @PostMapping("/addFollows")
    @ResponseBody
    public UnionResult addFollows(@RequestBody Follows follow){
        return UnionResult.OK(userService.addFollow(follow));
    }

    @ApiOperation("粉丝列表")
    @PostMapping("/getFollows")
    @ResponseBody
    public UnionResult getFollows(@RequestBody Users query){
        return UnionResult.OK(userService.getFollows(query));
    }

    @ApiOperation("关注列表")
    @PostMapping("/getMyFollows")
    @ResponseBody
    public UnionResult getMyFollows(@RequestBody Users query){
        return UnionResult.OK(userService.getMyFollows(query));
    }

    @ApiOperation("好友列表")
    @PostMapping("/getBingo")
    @ResponseBody
    public UnionResult getBingo(@RequestBody Users query){
        return UnionResult.OK(userService.getBingo(query));
    }

}
